home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / comm / uwpc201.zip / UW-SRC.ZIP / SCREEN.H < prev    next >
C/C++ Source or Header  |  1991-10-30  |  4KB  |  147 lines

  1. //-------------------------------------------------------------------------
  2. //
  3. // SCREEN.H - Direct screen accessing routines for textual displays.
  4. // 
  5. //  This file is part of UW/PC - a multi-window comms package for the PC.
  6. //  Copyright (C) 1990-1991  Rhys Weatherley
  7. //
  8. //  This program is free software; you can redistribute it and/or modify
  9. //  it under the terms of the GNU General Public License as published by
  10. //  the Free Software Foundation; either version 1, or (at your option)
  11. //  any later version.
  12. //
  13. //  This program is distributed in the hope that it will be useful,
  14. //  but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16. //  GNU General Public License for more details.
  17. //
  18. //  You should have received a copy of the GNU General Public License
  19. //  along with this program; if not, write to the Free Software
  20. //  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  21. //
  22. // Revision History:
  23. // ================
  24. //
  25. //  Version  DD/MM/YY  By  Description
  26. //  -------  --------  --  --------------------------------------
  27. //    1.0    23/03/91  RW  Original Version of SCREEN.H
  28. //    1.1    26/05/91  RW  Add command-line to "jumpdos".
  29. //
  30. // You may contact the author by:
  31. // =============================
  32. //
  33. //  e-mail: rhys@cs.uq.oz.au
  34. //    mail: Rhys Weatherley
  35. //          5 Horizon Drive
  36. //          Jamboree Heights
  37. //          Queensland 4074
  38. //        Australia
  39. //
  40. //-------------------------------------------------------------------------
  41.  
  42. #ifndef __SCREEN_H__
  43. #define    __SCREEN_H__
  44.  
  45. #include "extern.h"
  46.  
  47. //
  48. // Define the available hardware cursor shapes.
  49. //
  50. enum   CursorShapes {
  51.     CURS_INVISIBLE        = 0,    // Invisible cursor shape.
  52.     CURS_UNDERLINE        = 1,    // Underlining cursor shape.
  53.     CURS_HALF_HEIGHT    = 2,    // A half-height cursor shape.
  54.     CURS_FULL_HEIGHT    = 3    // A full-height cursor shape.
  55. };
  56.  
  57. //
  58. // Define the attribute information.
  59. //
  60. enum   ScreenAttrs {
  61.     ATTR_NORMAL        = 0,
  62.     ATTR_INVERSE        = 1,
  63.     ATTR_HIGHLIGHT        = 2,
  64.     ATTR_STATUS        = 3,
  65.     ATTR_HIGH_STATUS    = 4,
  66.     NUM_ATTRS        = 5
  67. };
  68.  
  69. //
  70. // The rest of this file doesn't apply to the Windows 3.0 version.
  71. //
  72. #ifndef    UWPC_WINDOWS
  73.  
  74. //
  75. // Define the hardware screen object.  An instance of this
  76. // object is created statically as "HardwareScreen".  All
  77. // (x,y) co-ordinates have their origin at (0,0).
  78. //
  79. class    ScreenClass {
  80.  
  81. private:
  82.  
  83.     unsigned far    *screenram;    // Position of the hardware screen RAM.
  84.     int     flags;            // Internal hardware screen flags.
  85.     unsigned char    oldattr;    // Old screen attribute to be restored.
  86.     int     mode;            // Screen mode being used.
  87.     int     saveshape;        // Saved cursor shape
  88.     int     savex,savey;        // Saved cursor position.
  89.     int     dlgx1,dlgy1,dlgx2,dlgy2; // Position of the dialog box.
  90.  
  91. public:
  92.  
  93.     int    width,height;        // Size of the hardware screen.
  94.     unsigned char    attributes[NUM_ATTRS]; // Attribute indexes.
  95.     int     dialogenabled;        // Non-zero if a dialog box is enabled.
  96.  
  97.     // Initialise the hardware screen.  Returns non-zero
  98.     // if OK, or zero if there is not enough memory.
  99.     int    init    (int color=1,int large=1);
  100.  
  101.     // Terminate the hardware screen.
  102.     void    term    (void);
  103.  
  104.     // Test to see if a colour mode is in effect.
  105.     int    iscolor    (void);
  106.  
  107.     // Set the position of the hardware screen cursor.
  108.     void    cursor    (int x,int y);
  109.  
  110.     // Set the shape of the hardware cursor.
  111.     void    shape    (CursorShapes curs);
  112.  
  113.     // Ring the hardware terminal bell.
  114.     void    bell    (void);
  115.  
  116.     // Mark an area for the dialog box.
  117.     void    mark    (int x1,int y1,int x2,int y2);
  118.  
  119.     // Clear the marked dialog box area.
  120.     void    clearmark (void) { dialogenabled = 0; };
  121.  
  122.     // Draw a character/attribute pair on the screen.
  123.     void    draw    (int x,int y,unsigned pair,int dialog=0);
  124.  
  125.     // Draw a lines of character/attribute pairs on the screen.
  126.     void    line    (int x,int y,unsigned *pairs,int numpairs,
  127.              int dialog=0);
  128.  
  129.     // Scroll an area of the screen a number of lines.
  130.     void    scroll    (int x1,int y1,int x2,int y2,int lines,
  131.              unsigned char attr);
  132.  
  133.     // Clear the screen and shell out to DOS.  Restore the screen
  134.     // mode on return (caller is responsible for screen redraw).
  135.     // Optionally execute a DOS command.
  136.     void    jumpdos    (char *cmdline);
  137. };
  138.  
  139. //
  140. // Define the primary hardware screen handling object.
  141. //
  142. extern    ScreenClass    HardwareScreen;
  143.  
  144. #endif    /* UWPC_WINDOWS */
  145.  
  146. #endif    /* __SCREEN_H__ */
  147.